import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ElevatorEventForm, ElevatorEventQuery, ElevatorEventVO } from '@/api/iot/elevatorEvent/types';

/**
 * 查询电梯事件列表
 * @param query
 * @returns {*}
 */

export const listElevatorEvent = (query?: ElevatorEventQuery): AxiosPromise<ElevatorEventVO[]> => {
  return request({
    url: '/iot/elevatorEvent/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询电梯事件详细
 * @param eventId
 */
export const getElevatorEvent = (eventId: string | number): AxiosPromise<ElevatorEventVO> => {
  return request({
    url: '/iot/elevatorEvent/' + eventId,
    method: 'get'
  });
};

/**
 * 新增电梯事件
 * @param data
 */
export const addElevatorEvent = (data: ElevatorEventForm) => {
  return request({
    url: '/iot/elevatorEvent',
    method: 'post',
    data: data
  });
};

/**
 * 修改电梯事件
 * @param data
 */
export const updateElevatorEvent = (data: ElevatorEventForm) => {
  return request({
    url: '/iot/elevatorEvent',
    method: 'put',
    data: data
  });
};

/**
 * 删除电梯事件
 * @param eventId
 */
export const delElevatorEvent = (eventId: string | number | Array<string | number>) => {
  return request({
    url: '/iot/elevatorEvent/' + eventId,
    method: 'delete'
  });
};
